package jnpf.engine.custom.cmd.commons;

import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.impl.util.CommandContextUtil;

public class SetSecondExecutionEntityVariableCmd implements Command<Void> {
    protected String taskExecutionId;
    protected String name;
    protected String value;
    @Override
    public  Void execute(CommandContext commandContext) {
        ExecutionEntity executionEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(taskExecutionId);
        ExecutionEntity parent = executionEntity.getParent();
        parent.setVariableLocal("branchList",value);
        return null;
    }

    public SetSecondExecutionEntityVariableCmd(String taskExecutionId, String name, String value) {
        this.taskExecutionId = taskExecutionId;
        this.name = name;
        this.value = value;
    }
}
